//
//  HeroCollectionCell.m
//  MyDota
//
//  Created by 濮亚军 on 15/12/2.
//  Copyright © 2015年 濮亚军. All rights reserved.
//

#import "HeroCollectionCell.h"
@interface HeroCollectionCell()

//英雄头像
@property(nonatomic, strong)UIImageView *heroIcon;

//英雄名称
@property(nonatomic, strong)UILabel *heroName;

@end
@implementation HeroCollectionCell
#pragma mark --------重写init 自定义cell--------
-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        //设置阴影效果
        self.backgroundColor = [UIColor whiteColor];
        self.layer.shadowOffset = CGSizeMake(0, 3);
        self.layer.shadowRadius = 5.0;
        self.layer.shadowColor = [UIColor blackColor].CGColor;
        self.layer.shadowOpacity = 0.8;
        
        CGFloat width = frame.size.width;
        CGFloat height = frame.size.height;
        
        //英雄头像
        self.heroIcon = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, width, width)];
        self.heroIcon.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_heroIcon];
        
        self.heroName = [[UILabel alloc]initWithFrame:CGRectMake(0, width, width, height - width)];
        self.heroName.backgroundColor = [UIColor blackColor];
        self.heroName.textColor = [UIColor whiteColor];
        self.heroName.textAlignment = NSTextAlignmentCenter;
        //self.heroName.text = @"幻影刺客";
        self.heroName.font = [UIFont systemFontOfSize:kScreenWidth / 25];
        [self.contentView addSubview:_heroName];
    }
    return self;
}
//赋值
-(void)setHeroModel:(HeroModel *)heroModel
{
    _heroModel = heroModel;
    self.heroName.text = heroModel.heroName;
    [self.heroIcon sd_setImageWithURL:[NSURL URLWithString:heroModel.heroIcon]];
    NSLog(@"%@", heroModel.positionArray);
}


@end
